new Handle:g_Name = INVALID_HANDLE
new Handle:g_NameTag = INVALID_HANDLE
new Handle:g_NameTag2 = INVALID_HANDLE
new Handle:g_Custom = INVALID_HANDLE

//--------------------------------------------------------------------//
// Here we doing some various stuff like precaching models and sounds //
// and checking if admin joined the game for the TAG------------------//
//--------------------------------------------------------------------//
public OnClientPostAdminCheck(client)
{
	if (IsFakeClient(client))
		return

	SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage)
	SDKHook(client, SDKHook_WeaponDrop, OnWeaponDrop)
	
	if (GetConVarInt(g_Custom) == 1)
		CustomMapFix()

	if(GetConVarBool(g_Name))
	{
		new AdminId:admin = GetUserAdmin(client)
		if(admin != INVALID_ADMIN_ID)
		{
			ChangeClientName(client)
		}
	}
}

//-----------------------------------------------//
// Here we add the tag before a name of an Admin //
//-----------------------------------------------//
public Action:ChangeClientName(client)
{
	decl String:org_name[MAX_NAME_LENGTH]
	decl String:new_name[MAX_NAME_LENGTH]
	decl String:tag_name[MAX_NAME_LENGTH]
	decl String:tag_name2[MAX_NAME_LENGTH]

	GetConVarString(g_NameTag, tag_name, sizeof(tag_name))
	GetConVarString(g_NameTag2, tag_name2, sizeof(tag_name2))
	GetClientName(client, org_name, sizeof(org_name))

	if (StrContains(org_name, tag_name, false) != -1)
		return Plugin_Handled

	if (StrContains(org_name, tag_name2, false) != -1)
		return Plugin_Handled

	Format(new_name, sizeof(new_name), "%s%s", tag_name, org_name)
	ClientCommand(client, "SetInfo name \"%s\"", new_name)
	return Plugin_Handled
}